<?php

use App\Http\Controllers\IndexController;
use App\Http\Controllers\Pay\YpayController;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', [IndexController::class, 'sy']);
Route::any('user/login', [IndexController::class, 'login'])->name('login');
Route::any('user/register', [IndexController::class, 'register']);
Route::any('user/password-reset', [IndexController::class, 'password_reset']);
Route::any('dwz/{id}', [IndexController::class, 'dwz']);
Route::any('dwz', [IndexController::class, 'gxsc']);

//用户中心
Route::group(['middleware' => ['web','userlogin']], function () {
    Route::get('/user', [IndexController::class, 'index']);
    Route::get('/user/forward-list', [IndexController::class, 'forward_list']);
    Route::get('/user/forward-add', [IndexController::class, 'forward_add']);
    Route::get('/user/forward-edit/{id}', [IndexController::class, 'forward_edit']);
    Route::get('/user/forward-info/{id}', [IndexController::class, 'forward_info']);

    Route::get('/user/domain-list', [IndexController::class, 'domain_list']);
    Route::get('/user/domain-add', [IndexController::class, 'domain_add']);
    Route::get('/user/domain-edit/{id}', [IndexController::class, 'domain_edit']);

    Route::get('/user/dwz-list/{id}', [IndexController::class, 'dwz_list']);
    Route::get('/user/dwz-add/{id}', [IndexController::class, 'dwz_add']);
    Route::get('/user/dwz-edit/{id}', [IndexController::class, 'dwz_edit']);

    Route::get('/user/dwz-list', [IndexController::class, 'dwz_lists']);
    Route::get('/user/logout', [IndexController::class, 'logout']);
    Route::get('/user/password-edit', [IndexController::class, 'password_edit']);
});

Route::group(['middleware' => ['web'],'prefix' => 'pay'], function () {
    //易支付
    Route::post('epay', [YpayController::class, 'gateway']);
    Route::get('epay/return_url',  [YpayController::class, 'returnUrl'])->name('ypay-return');
    Route::any('epay/notify_url', [YpayController::class, 'notifyUrl']); //回调
});

Route::any('{code}', [IndexController::class, 'dwz_link']);

